package com.xingqing.config;

import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.PathMatchConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@Configuration
public class GlobalApiPrefixConfig implements WebMvcConfigurer {
    
    @Override
    public void configurePathMatch(PathMatchConfigurer configurer) {
        log.info("正在配置全局API前缀：/api");
        configurer.addPathPrefix("/api", c -> c.isAnnotationPresent(RestController.class));
        log.info("全局API前缀配置完成");
    }
}